package cn.zwxky.android.staff.Follow;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.zgscwjm.lsfbbasetemplate.Event.LsfbEvent;
import com.zgscwjm.lsfbbasetemplate.adapter.CommonRecycAdapter;
import com.zgscwjm.lsfbbasetemplate.adapter.ViewHolderRecyc;

import java.util.List;

import cn.zwxky.android.staff.R;
import cn.zwxky.android.staff.Utils.URLString;

/**
 * Created by Administrator on 2017/4/6 0006.
 */

public class ArrangeAdapter extends CommonRecycAdapter<NormalTaskBean.ListBean> {
    private Context mcontext;
    public ArrangeAdapter(Context context, List<NormalTaskBean.ListBean> list, int layoutId) {
        super(context, list, layoutId);
        mcontext=context;
    }

    @Override
    public void convert(ViewHolderRecyc holder, final NormalTaskBean.ListBean model) {
        holder.setImg(R.id.fg_my_img_head, URLString.IMG_URL+model.getImg(),R.mipmap.img_my_details_head);
        holder.setText(R.id.item_arrange_text_name,model.getName());
        holder.setText(R.id.item_arrange_text_tiem,model.getTimes());
        holder.setText(R.id.item_arrange_text_content,model.getContent());
        holder.setText(R.id.item_arrange_text_number,model.getCount()+"条回复");
        TextView textView=holder.getView(R.id.item_arrange_text_status);

        //0未完成,1员工点完成（灰）,2领导点完成（灰），3完成（绿）
        if (model.getStatus().equals("0")){
            holder.setText(R.id.item_arrange_text_status,"");
        }else if (model.getStatus().equals("1") || model.getStatus().equals("2")){
            holder.setText(R.id.item_arrange_text_status,"完成");
            textView.setTextColor(mcontext.getResources().getColor(R.color.bottom_unchecked_color2));
        }else if (model.getStatus().equals("3")){
            holder.setText(R.id.item_arrange_text_status,"完成");
            textView.setTextColor(mcontext.getResources().getColor(R.color.label_green));
        }

        holder.setOnclick(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ArrangeClickEvent even = new ArrangeClickEvent();
                even.setData(model.getId());
                LsfbEvent.getInstantiation().post(even);
            }
        });

    }
}
